

/**
 * 创建entity Point
 */
import Entity from '../Entity'

const DEFAULT_STYLE = {
  pixelSize:15,
  color : Cesium.Color.DEEPSKYBLUE,
  outlineColor : Cesium.Color.YELLOW,
}

export default class Point extends Entity {

  /**
   * 创建一个Point实体对象
   * @param {*} position
   * @param {*} options 
   */
  constructor(positions, options = {}) {
    super()
    this._positions = positions
    this._type = 'point'
    this._style = {
      ...DEFAULT_STYLE,
      ...options
    }

    this.delegate = new Cesium.Entity({point: {}})
    this.mounted()
  }

  /**
  * 初始化对象属性
  */

  mounted() {
    this.style = this._style
    this.positions = this._positions
  }

  /** 
  * @param {*} style Circle的样式
  * @returns 
  */

  setStyle(style) {
    if (!style) return
    Object.assign(this._style , {...style})
    Object.assign(this.delegate.point, {...this._style})
  }

  get style(){
    return this._style
  }

  set style(val){
    Object.assign(this._style , {...val})
    Object.assign(this.delegate.point , {...this._style})
  }

  get positions() {
    return this._positions
  }

  set positions(val) {
    this._positions = val
    this.delegate.position = this._positions
  }
}
